package com.itic.system.wx.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.itic.appbase.framework.common.constants.DBConst;
import com.itic.appbase.framework.common.service.CrudService;
import com.itic.system.wx.persistence.dao.HppwxDao;
import com.itic.system.wx.persistence.model.Hppwx;
import com.itic.system.wx.persistence.model.HppwxExample;
import com.itic.system.wx.persistence.model.HppwxExample.Criteria;

@Service
@Transactional
public class HppwxService
     extends CrudService<HppwxDao,Hppwx,HppwxExample> {
    @Autowired
    private HppwxDao hppwxDao;
    /**
     * 根据类型查数据
     * @param type
     * @return
     */
    public Hppwx getHppwxByType(String type){
    	Hppwx hppwx = null;
    	HppwxExample example = new HppwxExample();
    	Criteria criteria = example.createCriteria();
    	criteria.andIsEffectiveEqualTo(DBConst.TRUE);
    	criteria.andTypeEqualTo(type);
    	List<Hppwx> list = this.list(example);
    	if(list.size()>0){
    		hppwx = list.get(0);
    	}
    	return hppwx;
    }
}